home *** CD-ROM | disk | FTP | other *** search
/ Agent Central Host Computer / Agent - Central Host Computer.iso / _SETUP.1 / vcscurdetail.sql < prev    next >
Text File  |  2000-05-12  |  1KB  |  23 lines

  1. /*  For sequence numbers determined by vcurstaterange, this view "flattens" the associated entries in the cscurcnt table, collecting all coins and bills by type, using the decode function, and then sums the coin and bill amounts.
  2. */
  3. CREATE OR REPLACE VIEW VCSCURDETAIL  AS SELECT vcurstaterange.conversion_num,  
  4. vcurstaterange.close_count,  
  5. vcurstaterange.cashbox_glid,  
  6. SUM(CSCURCNT.reset_value ) totalcash,  
  7. SUM(DECODE(currency_type, 204, reset_value, 0)) cents_$,  
  8. SUM(DECODE(currency_type, 203, reset_value, 0)) nickels_$,  
  9. SUM(DECODE(currency_type, 202, reset_value, 0)) dimes_$,  
  10. SUM(DECODE(currency_type, 201, reset_value, 0)) quarters_$,  
  11. SUM(DECODE(currency_type, 205, reset_value, 0)) halfs_$,  
  12. SUM(DECODE(currency_type, 206, reset_value, 0)) sbas_$,  
  13. SUM(DECODE(currency_type, 250, reset_count, 0)) sm_tokens,  
  14. SUM(DECODE(currency_type, 251, reset_count, 0)) lg_tokens,  
  15. SUM(DECODE(currency_type, 301, reset_value, 0)) ones_$,  
  16. SUM(DECODE(currency_type, 302, reset_value, 0)) fives_$,  
  17. SUM(DECODE(currency_type, 303, reset_value, 0)) tens_$,  
  18. SUM(DECODE(currency_type, 304, reset_value, 0)) twenties_$  
  19. FROM vcurstaterange, CSCURCNT  
  20. WHERE CSCURCNT.det_seq_num = close_count  
  21. GROUP BY conversion_num,  close_count,vcurstaterange.cashbox_glid;
  22.  
  23.